# -*- coding: UTF-8 -*-
import app_server_aliyun
import utime as time
import app_network
import app_led
import app_adc

def main():
    app_led.led_disp_thread()
    ret = app_network.connect_network()
    print("ret:",ret)
    if ret == True:
        #修改此处"deviceName" , "productKey" ,  "deviceSecret" 
        app_server_aliyun.aliyun_login("test","a1laDtv9VrO","1ab64a4ef684bc932618fa67df70c6c1")
    else:
        print('network-connection failed')

    
    while True:
        ai1=app_adc.get_ai_current_value()[0]
        ai2=app_adc.get_ai_current_value()[1]
        app_server_aliyun.update('AI1',ai1)
        app_server_aliyun.update('AI2',ai2)
        app_server_aliyun.update('version',app_server_aliyun.get_app_version())
        time.sleep(1)
    

if __name__ == '__main__':
    time.sleep(5)
    main()
